<template>
  <div>
    <van-pull-refresh v-model="info.pullLoading" @refresh="onRefresh">
      <van-list
        v-model:loading="info.loading"
        v-model:error="info.error"
        :finished="info.finished"
        finished-text="没有更多了"
        @load="onLoad"
      >
        <slot></slot>
      </van-list>
    </van-pull-refresh>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

let num = ref(12);
let info = ref({
  loading: false, //加载中
  error: false, //加载错误
  finished: false, //加载结束
  pullLoading: false, //下拉刷新
});
const onRefresh = () => {
  console.log("下拉刷新");
  info.value.pullLoading = false;
};
const onLoad = () => {
  setTimeout(() => {
    num.value += 15;
    info.value.loading = false;
    console.log("滚动加载");
    // info.value.finished = true;
  }, 2000);
};
</script>

<style></style>
